﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/FlashCardPage.Master"
    CodeBehind="FlashCardList.aspx.cs" Inherits="FlashCards.WebGUI.FlashCardList" %>

<asp:Content ContentPlaceHolderID="mainContent" runat="server">
<asp:ScriptManager ID="smMain" runat="server"></asp:ScriptManager>

    <asp:UpdatePanel ID="upMain" runat="server">
        <ContentTemplate>
            <asp:Label ID="lblFilterWord" runat="server" Text="Word filter:"></asp:Label>
            <asp:TextBox ID="txtFilterWord" runat="server"></asp:TextBox>
            <asp:Label ID="lblFilterGrammaticalCategory" runat="server" Text="Grammatical category filter:"></asp:Label>            
            <asp:TextBox ID="txtFilterGrammaticalCategory" runat="server"></asp:TextBox>
            <asp:Button ID="btnRefresh" runat="server" Text="Refresh" />
            
            <asp:GridView
                ID="gvFlashCards" runat="server" AutoGenerateColumns="False" 
                DataSourceID="dsFlashcards" Width="100%" 
                EnableSortingAndPagingCallbacks="True">
                <Columns>
                    <asp:BoundField DataField="Id" HeaderText="Id" 
                        SortExpression="Id" Visible="False" />
                    <asp:BoundField DataField="OriginalWord" HeaderText="Word" 
                        SortExpression="OriginalWord" />
                    <asp:BoundField DataField="GrammaticalCategory" 
                        HeaderText="Gr. category" SortExpression="GrammaticalCategory" />
                    <asp:BoundField DataField="Unit" HeaderText="Unit" SortExpression="Unit" />
                    <asp:BoundField DataField="ModifiedBy" HeaderText="Modified by" 
                        SortExpression="ModifiedBy" />
                    <asp:BoundField DataField="ModifiedAt" HeaderText="Modified" 
                        SortExpression="ModifiedAt" />
                    <asp:HyperLinkField DataNavigateUrlFields="Id" 
                        DataNavigateUrlFormatString="FlashCardDetails.aspx?Id={0}" Text="..." HeaderText="Details" />
                </Columns>
            </asp:GridView>            
            <asp:HyperLink ID="hlNewFlashCard" runat="server" 
                NavigateUrl="~/FlashCardDetails.aspx">Add new word...</asp:HyperLink>
            <asp:ObjectDataSource ID="dsFlashcards" runat="server" SelectMethod="ListWords" 
                TypeName="FlashCards.WebGUI.FlashCardService.FlashCardsServiceClient">
                <SelectParameters>
                    <asp:ControlParameter ControlID="txtFilterWord" Name="wordFilter" 
                        PropertyName="Text" Type="String" />
                    <asp:ControlParameter ControlID="txtFilterGrammaticalCategory" 
                        Name="categoryFilter" PropertyName="Text" Type="String" />
                    <asp:SessionParameter Name="language" SessionField="CurrentLanguage" 
                        Type="Object" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
